from django.shortcuts import render, redirect, HttpResponseRedirect
from web.forms.account import login_form


def login(request):
    '''登录'''
    if request.method == 'GET':
        form = login_form(request)
        return render(request, 'login.html', locals())
    form = login_form(request, data=request.POST)
    if form.is_valid():
        return redirect('customer_list')
    return render(request, 'login.html', locals())
